<?php


namespace app\model;
use think\Model;

class User extends Model
{
    //关联文章，根据用户ID来查询
    public function article(){
        //用户模型中添加方法，关联文章模型/类，文章模型中关联的ID/外键，用户模型中主键
        return $this->hasMany(Article::class,'user_id','id');

    }
}